<%@ Page language="c#" Codebehind="CMDLogParserDemo.aspx.cs" AutoEventWireup="false" Inherits="AjaxLabCmd.CMDLogParserDemo" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>CMDLogParserDemo</title>
		<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
		<meta name="CODE_LANGUAGE" Content="C#">
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<link href="ScriptLibrary/windows_js_0.85.2/themes/default.css" rel="stylesheet" type="text/css">
		<link href="ScriptLibrary/windows_js_0.85.2/themes/theme1.css" rel="stylesheet" type="text/css">
		<link rel="stylesheet" type="text/css" href="ScriptLibrary/windows_js_0.85.2/themes/mac_os_x.css">
		<link rel="stylesheet" type="text/css" href="ScriptLibrary/windows_js_0.85.2/themes/alphacube.css">
		<script language="JavaScript" type="text/javascript" src="ScriptLibrary/Atlas/Release/AtlasCompat.js"></script>
		<script language="JavaScript" type="text/javascript" src="ScriptLibrary/Atlas/Release/Atlas.js"></script>
		<script language="JavaScript" type="text/javascript" src="ScriptLibrary/scriptaculous-js-1.6.0/lib/prototype.js"></script>
		<script language="JavaScript" type="text/javascript" src="ScriptLibrary/scriptaculous-js-1.6.0/src/effects.js"></script>
		<script language="JavaScript" type="text/javascript" src="ScriptLibrary/windows_js_0.85.2/javascripts/window.js"></script>
		<script language="JavaScript" type="text/javascript" src="ScriptLibrary/AjaxLabCommandPrompt/Engine/Abstract/CMD.js"></script>
		<script language="JavaScript" type="text/javascript" src="ScriptLibrary/AjaxLabCommandPrompt/Engine/Core/CMD.js"></script>
		<script type="text/javascript">
		
		
		function pageLoad()
		{
			openDebugWindow();
			openCmd();
			
		}
		
		function openCmd()
		{
			var cmd = new AjaxLab.Engine.Core.Cmd("Cmd","CmdPrompt","item","http://www.ajaxlab.com");
			cmd.setIsDebug(false);
			openContentWindow();
		}
		
		function openContentWindow() {

				var contentWin = new Window('content_win', {
														className: "alphacube",
														title: "AjaxLab Command Prompt",
														maximizable: true, 
														resizable: true, 
														closable: false,
														hideEffect:Element.hide, 
														showEffect:Element.show
														}
										)

				var width = $('test_content').offsetWidth;
				var height = $('test_content').offsetHeight;
				contentWin.setContent('test_content', true, true);
				contentWin.setSize(width,height);
				contentWin.setLocation(20,120);
				contentWin.toFront();
				contentWin.setDestroyOnClose();
				contentWin.show();
				//contentWin.showCenter(true);	
				var myObserver = { 
					onEndResize	:	function(eventName, win)
					{
						if(win == contentWin)
						{
							$('CmdPrompt').style.width = win.width-15+"px";
							$('CmdPrompt').style.height = win.height-15+"px";
						}
					}, 
					
					onEndMaximize: function(eventName, win)
					{
						if(win == contentWin)
						{
							$('CmdPrompt').style.width = win.width-15+"px";
							$('CmdPrompt').style.height = win.height-15+"px";
						}
					}
				}
				Windows.addObserver(myObserver);
		}
		
		function openDebugWindow()
		{
				var contentWin = new Window('content_debug', {
														className: "dialog",
														title: "AjaxLab Command Prompt Debug",
														maximizable: true, 
														resizable: true,
														closable: false, 
														hideEffect:Element.hide, 
														showEffect:Element.show
														}
										)
				var width = $('item').style.width;
				var height = $('item').style.height;
				contentWin.setContent('item', true, true);
				contentWin.setLocation(1220,120);
				contentWin.setSize(width,height);
				contentWin.toFront();
				contentWin.setDestroyOnClose();
				contentWin.show();	
				var myObserver = { 
					onEndResize	:	function(eventName, win)
					{
						if(win == contentWin)
						{
							$('item').style.width = win.width+"px";
							$('item').style.height = win.height+"px";
						}
					},
					
					onEndMaximize: function(eventName, win)
					{
						if(win == contentWin)
						{
							$('item').style.width = win.width+"px";
							$('item').style.height = win.height+"px";
						}
					}
					
				}
				Windows.addObserver(myObserver);
		}
		
		function BindSelectIPCount()
		{
			AjaxLabCmd.CMDLogParserDemo.SelectIPCount(IPCountCallBack);
		}
		
		function IPCountCallBack(res)
		{
			for(var i=0; i<res.value.Tables[0].Rows.length; i++)
			{
				$("IPCountResult").innerHTML=$("IPCountResult").innerHTML+res.value.Tables[0].Rows[i].IP + " : " + res.value.Tables[0].Rows[i].Total+"<br/>";
			}
		}
		
		</script>
	</HEAD>
	<body>
		<form runat="server">
		</form>
		<table id="test_content">
			<tr>
				<td>
					<textarea style="BACKGROUND:#000000; COLOR:#ffffff" id="CmdPrompt" cols="80" rows="20" wrap="virtual"></textarea>
				</td>
			</tr>
		</table>
		<div id="item" style="FONT-SIZE:12px; OVERFLOW:scroll; WIDTH:750px; HEIGHT:200px; BACKGROUND-COLOR:black">
		</div>
		<DIV id="myDiv" style="BORDER-RIGHT:red 1px solid; PADDING-RIGHT:2px; BORDER-TOP:red 1px solid; DISPLAY:none; PADDING-LEFT:2px; Z-INDEX:10; LEFT:0px; PADDING-BOTTOM:2px; BORDER-LEFT:red 1px solid; PADDING-TOP:2px; BORDER-BOTTOM:red 1px solid; POSITION:absolute; TOP:0px; BACKGROUND-COLOR:yellow">Suggested 
			text</DIV>
		<!-- <input type="button" value="Retrive IP" onClick="BindSelectIPCount();" /> -->
		<div id="IPCountResult">
		</div>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<P><STRONG><FONT size="5">Web Statistics Command Prompt<BR>
				</FONT></STRONG>
			<BR>
			<STRONG>Pick&nbsp;what Statistics you want to see and get the&nbsp;Stats you want 
				to get!!
				<BR>
			</STRONG>
			<BR>
			Web Statistcs Comamnd Prompt give you a list of command to execute and display 
			the approriate results back to you. No more useless info all clutered on the 
			same page. Pick what you want and you get it right away!
			<BR>
			<BR>
			All supported Web Statistic Log Query is largegly based on the article "<a href="http://www.securityfocus.com/infocus/1712">Forensic 
				Log Parsing with Microsoft's LogParser </a>by Mark Burnett 2003 - 07 - 18. 
			*Note, because AjaxLab Command Prompt is highly extensible and all cusotm 
			commands are&nbsp;"plug-ins", &nbsp;you can easily create unlimted amount of 
			other quries yourself based on the Plug-In Template.&nbsp; In fact, I used 
			the&nbsp;template myself to create these log commands.
			<BR>
		</P>
		<P dir="ltr"><STRONG>Framework Used</STRONG></P>
		<UL dir="ltr" style="MARGIN-RIGHT: 0px">
			<UL dir="ltr">
				<LI>
					<DIV>AjaxLab Command Prompt (obviously)</DIV>
				<LI>
					<DIV>AjaxPro.NET v 6.1&nbsp;&nbsp; (Use ajax to&nbsp;connect Ajaxlab Command Prompt 
						and the result of MS LogParser)</DIV>
				<LI>
					<DIV>MS Log Parser 2.2&nbsp;&nbsp; (Used to parse IIS Log Files from C#)</DIV>
				</LI>
			</UL>
		</UL>
		<P dir="ltr"><STRONG>Supported Log Commands</STRONG>&nbsp;
		</P>
		<BLOCKQUOTE dir="ltr" style="MARGIN-RIGHT: 0px">
			<P dir="ltr">All command can be appened a suffix via a number which indicates 
				number of&nbsp;records to show. By default, if nothing specified, 10 records 
				are shown.&nbsp; In addtion, the master command "webstats" can be used 
				interchangeably with the command "logparser" For example</P>
			<P dir="ltr">webstats top visitors 20<BR>
				logparser top visitors 20</P>
			<P dir="ltr"><EM><U>The Log&nbsp;Command List</U></EM></P>
		</BLOCKQUOTE>
		<UL dir="ltr" style="MARGIN-RIGHT: 0px">
			<UL dir="ltr">
				<LI>
					<DIV>webstats top visitors</DIV>
				<LI>
					<DIV>webstats top NonStandardUserAgent</DIV>
				<LI>
					<DIV>webstats top hits
					</DIV>
				<LI>
					<DIV>webstats top PossibleAttacks
					</DIV>
				<LI>
					<DIV>webstats top PageErrors
					</DIV>
				<LI>
					<DIV>webstats top HitsPerPage
					</DIV>
				<LI>
					<DIV>webstats top RecordedErrors
					</DIV>
				<LI>
					<DIV>webstats top BrokenLinks
					</DIV>
				<LI>
					<DIV>webstats top Win32Errors
					</DIV>
				<LI>
					<DIV>webstats top HttpMethods
					</DIV>
				<LI>
					<DIV>webstats top BytesSendToClient
					</DIV>
				<LI>
					<DIV>webstats top BytesSendFromClient
					</DIV>
				<LI>
					<DIV>webstats top TimeSpendProcessing</DIV>
				<LI>
					<DIV>webstats successful attempts</DIV>
				</LI>
			</UL>
		</UL>
		<BLOCKQUOTE dir="ltr" style="MARGIN-RIGHT: 0px">
			<P>and of course, as always, the base commands are&nbsp;always available</P>
			<P><EM><U>Base Commands List</U></EM></P>
			<EM><U></U></EM></BLOCKQUOTE>
		<UL dir="ltr" style="MARGIN-RIGHT: 0px">
			<UL>
				<LI>
					<DIV><EM><U></U></EM>clear</DIV>
				<LI>
					<DIV>enable debug</DIV>
				<LI>
					<DIV>disable debug</DIV>
				<LI>
					<DIV>clear debug</DIV>
				<LI>
					<DIV>openurl [your url] ex: openurl <A href="http://www.limingxu.com">http://www.limingxu.com</A></DIV>
				<LI>
					<DIV>cd [directory]&nbsp;&nbsp; ex: cd <A href="http://www.limingxu.com">http://www.limingxu.com</A><BR>
					</DIV>
				</LI>
			</UL>
		</UL>
		<BLOCKQUOTE dir="ltr" style="MARGIN-RIGHT: 0px">
			<p><EM><U>Bugs</U></EM></p>
			<P>Screen format is a bit messed up. Somebody care to fix this for me? :)
			</P>
			<P>Each print, didn't scroll to bottom. Even though it's working locally here for 
				me. WEIRD!
			</P>
			<P>Didn't try to validate input too much. If you entered somethign wrong and my 
				command promtp hangs? Try to refresh and becareful next time :)
			</P>
		</BLOCKQUOTE>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
	</body>
</HTML>
